package com.webmall.servlet.cate;

import com.webmall.entity.CateEntity;
import com.webmall.entity.UserEntity;
import com.webmall.service.webmall_CateDao;
import com.webmall.service.webmall_UserDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/manageHtml/admin_toCateModify")
public class ToCateModify extends HttpServlet {


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //获取请求 先设计字符集
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");

        //获取参数
        String id = request.getParameter("id");
        //select by id
        CateEntity cate = webmall_CateDao.selectById(id);

        request.setAttribute("cateModify",cate);
        ArrayList<CateEntity> cateList = webmall_CateDao.selectAll();
        request.setAttribute("catelist",cateList);
       // request.setAttribute("cpage",request.getParameter("cpage"));
        request.getRequestDispatcher("/manageHtml/admin_cateModify.jsp").forward(request,response);
    }
}
